var express = require('express');
var cluster = require('cluster');

var os = require('os');
var CPUS = os.cpus().length;
if (cluster.isMaster) {
  for (var i = 0; i < CPUS; i++) {
    cluster.fork();
  }
}
else {
  var PORT = 1235;
  var app = express();

  app.use(express.static('.'));
  app.listen(PORT, function() {
    console.log('server is running at %d', PORT);
  });

  app.get('/', function(req, res) {
    res.send('Root!');
  });

  app.get('/hello', function(req, res) {
    res.send('Hello!');
  });
}
